﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sexybeauty.Core.Inf.Entities.Table;

namespace Sexybeauty.Core.Inf.LogicEntity
{
    public class MemberResourceEntity : IAccessible<MemberResource,MemberResourceEntity>
    {
        #region Fileds
        public int Id { get; set; }
        public string UserName { get; set; }
        public CustomerFileType ResType { get; set; }
        /// <summary>
        /// 级别，私密、公开
        /// </summary>
        public CustomerFileLevel ResLevel { get; set; }
        public int ResGroup { get; set; }
        public string Path { get; set; }
        public string Comment { get; set; }
        public string Snapshot { get; set; }
        public DateTime UploadDate { get; set; }
        #endregion

        protected override void Covariant(MemberResource dbModel)
        {
            this.Id = dbModel.Id;
            this.UserName = dbModel.UserName;
            this.ResType = (CustomerFileType)dbModel.ResType;
            this.ResLevel = (CustomerFileLevel)dbModel.ResLevel;
            this.ResGroup = dbModel.ResGroup;
            this.Path = dbModel.Path;
            this.Comment = dbModel.Comment;
            this.Snapshot = dbModel.Snapshot;
            this.UploadDate = dbModel.UploadDate;
        }
        protected override MemberResource Inverter(MemberResourceEntity model)
        {
            return new MemberResource()
            {
                Comment = model.Comment,
                Id = model.Id,
                UserName = model.UserName,
                Path = model.Path,
                ResGroup = model.ResGroup,
                ResLevel = (int)model.ResLevel,
                ResType = (int)model.ResType,
                Snapshot = model.Snapshot,
                UploadDate = model.UploadDate
            };
        }
    }
}
